import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
import { ApiProperty } from '@nestjs/swagger';

// 评论状态枚举
export enum StorageStatus {
  PENDING = 'pending', // 待审核
  APPROVED = 'approved', // 审核通过
}

@Schema({
  timestamps: true,
  collection: 'storage', // 集合名称
  versionKey: false, // 不返回版本字段
})
export class Storage extends Document {
  @Prop({ required: true, type: String })
  @ApiProperty({ description: '文件名' })
  name: string;

  @Prop({ type: String })
  @ApiProperty({ description: '真实文件名' })
  fileName: string;

  @Prop({ type: String })
  @ApiProperty({ description: '扩展名' })
  extName: string;

  @Prop({ type: String })
  @ApiProperty({ description: '文件路径' })
  path: string;

  @Prop({ type: String })
  @ApiProperty({ description: '文件类型' })
  type: string;

  @Prop({ type: String })
  @ApiProperty({ description: '文件大小' })
  size: string;
}

export const StorageSchema = SchemaFactory.createForClass(Storage);
